﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="dnChiTieuKyThuat.ascx.cs" Inherits="uicontrol_dnChiTieuKyThuat" %>
<asp:SqlDataSource ID="dsHD" runat="server" ConnectionString="<%$ ConnectionStrings:evaConn %>"
    SelectCommand="SELECT TenHoiDong, MaHoiDong, MaDoanhNghiep FROM HoiDong WHERE (MaDoanhNghiep = @MaDoanhNghiep) AND (Status=1)">
    <SelectParameters>
        <asp:SessionParameter Name="MaDoanhNghiep" SessionField="CompanyID" />
    </SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="dsCT" runat="server" ConnectionString="<%$ ConnectionStrings:evaConn %>"
    SelectCommand="SELECT BangChiTieu.MaChiTieu, BangChiTieu.TenChiTieu, BangChiTieu.GhiChu, BangChiTieu.MaHoiDong, HoiDong.MaDoanhNghiep FROM BangChiTieu INNER JOIN HoiDong ON BangChiTieu.MaHoiDong = HoiDong.MaHoiDong WHERE (HoiDong.MaDoanhNghiep = @MaDoanhNghiep)">
    <SelectParameters>
        <asp:SessionParameter DefaultValue="0" Name="MaDoanhNghiep" SessionField="CompanyID" />
    </SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="dsCT_Act" runat="server" ConnectionString="<%$ ConnectionStrings:evaConn %>"
    SelectCommand="SELECT MaChiTieu, TenChiTieu, GhiChu, MaHoiDong FROM BangChiTieu WHERE (MaChiTieu = @MaChiTieu)" 
    UpdateCommand="UPDATE BangChiTieu SET TenChiTieu = @TenChiTieu, MaHoiDong = @MaHoiDong, GhiChu = @GhiChu WHERE (MaChiTieu = @MaChiTieu)" 
    InsertCommand="INSERT INTO BangChiTieu(TenChiTieu, MaHoiDong, GhiChu) VALUES (@TenChiTieu, @MaHoiDong, @GhiChu)" DeleteCommand="DELETE FROM BangChiTieu WHERE (MaChiTieu = @MaChiTieu)">
    <UpdateParameters>
        <asp:ControlParameter ControlID="txtTenChiTieu" Name="TenChiTieu" PropertyName="Text" />
        <asp:ControlParameter ControlID="ddlHD" Name="MaHoiDong" PropertyName="SelectedValue" />
        <asp:ControlParameter ControlID="txtGhiChu" Name="GhiChu" PropertyName="Text" />        
    </UpdateParameters>
    <InsertParameters>
        <asp:ControlParameter ControlID="txtTenChiTieu" Name="TenChiTieu" PropertyName="Text" />
        <asp:ControlParameter ControlID="ddlHD" Name="MaHoiDong" PropertyName="SelectedValue" />
        <asp:ControlParameter ControlID="txtGhiChu" Name="GhiChu" PropertyName="Text" />
    </InsertParameters>    
</asp:SqlDataSource>
<table style="width:600px">
    <tr>
        <td colspan="3">
            <asp:Label ID="Label5" runat="server" CssClass="LabelTitle" Text="CHỈ TIÊU KỸ THUẬT CHO DOANH NGHIỆP"></asp:Label></td>
    </tr>
    <tr>
        <td style="width: 30%">
        </td>
        <td style="width: 40%">
            &nbsp;</td>
        <td>
        </td>
    </tr>
    <tr>
        <td style="width:30%">
            <asp:Label ID="Label1" runat="server" CssClass="Label" Text="Tên chỉ tiêu"></asp:Label></td>
        <td style="width:40%">
            <asp:TextBox ID="txtTenChiTieu" runat="server" MaxLength="256"></asp:TextBox></td>
        <td>
            <asp:RequiredFieldValidator ID="rfvTenChiTieu" runat="server" ErrorMessage="Không được trống" ControlToValidate="txtTenChiTieu" CssClass="ValidateLabel"></asp:RequiredFieldValidator></td>
    </tr>
    <tr>
        <td>
            <asp:Label ID="Label2" runat="server" CssClass="Label" Text="Hội đồng chấm điểm"></asp:Label></td>
        <td>
            <asp:DropDownList ID="ddlHD" runat="server" CssClass="DropdownList" DataSourceID="dsHD" DataTextField="TenHoiDong" DataValueField="MaHoiDong">
            </asp:DropDownList></td>
        <td>
        </td>
    </tr>
    <tr>
        <td>
            <asp:Label ID="Label3" runat="server" CssClass="Label" Text="Ghi chú"></asp:Label></td>
        <td>
            <asp:TextBox ID="txtGhiChu" runat="server" CssClass="TextArea" MaxLength="512" TextMode="MultiLine" /></td>
        <td>
        </td>
    </tr>
    <tr>
        <td>
        </td>
        <td>
            <asp:Button ID="btnNew" runat="server" CssClass="Button" Text="Tạo mới" OnClick="btnNew_Click" />
            <asp:Button ID="btnEdit" runat="server" CssClass="Button" Text="Cập nhật" Visible="False" OnClick="btnEdit_Click" />
            <asp:Button ID="btnCancel" runat="server" CausesValidation="False" CssClass="Button"
                OnClick="btnCancel_Click" Text="Làm lại" /></td>
        <td>
        </td>
    </tr>
</table>
<table style="width:600px">
    <tr><td>
        <asp:Label ID="lblNotify" runat="server" CssClass="LabelResult" Text="Các chỉ tiêu kỹ thuật của Doanh Nghiệp :"></asp:Label></td></tr>
    <tr><td>
        <asp:GridView ID="grvCT" runat="server" AllowPaging="True" DataSourceID="dsCT" PageSize="5" CssClass="Grv" AutoGenerateColumns="False" OnRowDataBound="grvCT_RowDataBound" OnRowCommand="grvCT_RowCommand">
            <Columns>
                <asp:BoundField DataField="MaChiTieu" HeaderText="MaChiTieu" />
                <asp:BoundField DataField="TenChiTieu" HeaderText="T&#234;n chỉ ti&#234;u" >
                    <ItemStyle Width="40%" />
                </asp:BoundField>                                  
                <asp:BoundField DataField="MaHoiDong" HeaderText="MaHoiDong" />
                <asp:BoundField DataField="GhiChu" HeaderText="Ghi ch&#250;" />                    
                <asp:TemplateField HeaderText="Chức năng">
                    <ItemTemplate>
                            <asp:ImageButton ID="sua" CommandArgument='<%# Eval("MaChiTieu") %>' CommandName="Sua" runat="server" ImageUrl="~/App_Themes/Default/Css/images/edit.gif" CausesValidation="false" AlternateText="Sửa lại thông tin Chỉ tiêu"/>
                            <asp:ImageButton ID="delete" CommandArgument='<%# Eval("MaChiTieu") %>' CommandName="Xoa" runat="server" ImageUrl="~/App_Themes/Default/Css/images/delete.gif" CausesValidation="false" AlternateText="Xóa chỉ tiêu"/>                        
                    </ItemTemplate>
                    <ItemStyle Width="10%" />
                </asp:TemplateField>
            </Columns>
            <PagerStyle CssClass="GrvPagerStyle"/>
                <HeaderStyle CssClass="GrvHeader" />
                <RowStyle CssClass="GrvRowStyle"/>
                <AlternatingRowStyle CssClass="GrvAlternatingRowStyle" />
        </asp:GridView>
    </td></tr>
</table>